<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>页面计算器</title>
    <style>
        #cal{
            width: 600px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
<div id="cal">
{#    把它提交到当前根目录下的路径下执行#}
    <form action="/caculator/" method="post">
        <label>
            <input type="text" name="x" value="{{ x }}">
        </label>
        <label>
            <select name="op">
                <option value="add" {% if op == "add" %} selected{% endif %}>加</option>
                <option value="sub" {% if op == "sub" %} selected{% endif %}>减</option>
                <option value="mul" {% if op == "mul" %} selected{% endif %}>乘</option>
                <option value="div" {% if op == "div" %} selected{% endif %}>除</option>
            </select>
        </label>
        <label>
            <input type="text" name="y" value="{{ y }}">=<span>{{ result }}</span>
        </label>
        <div><input type="submit" value="开始计算"></div>
    </form>
</div>
</body>
</html>